<%@include file="restrict_to_not_logged_in.jsp"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
<title>Hammer Time Auctions</title>
<script language="javascript" type="text/javascript">
	function loginClicked() {
		javascript: login.submit();
	}
</script>
</head>
<body>
	<div id="content">
		<%@include file="header.jsp"%>
		<h1>Welcome Back - Sign in</h1>
		<hr></hr>
		<div class="sidebar right margin-5px padding-5px">
			<%
				// Display the list of registration errors if there are any.
				if (session.getAttribute("login_errors") != null) {
					out.println("<div class=\"section padding-5px error-text\">");
					out.println(session.getAttribute("login_errors"));
					out.println("</div>");
				}
				// Check if there were previously entered values for the form. If there aren't then use an
				// empty string.
				if (session.getAttribute("username") == null) {
					session.setAttribute("username", "");
				}
			%>
		</div>
		<div class="center" id="login-box">
			<form name="login" action="login_validate.jsp" method="post">
				<table>
					<tr>
						<td><label class="form-label" for="username">Username:</label></td>
						<td><input name="username" type="text"
							value="<%=session.getAttribute("username")%>" /></td>
					</tr>
					<tr>
						<td><label class="form-label" for="password">Password:</label></td>
						<td><input name="password" class="right" type="password" /></td>
					</tr>
					<tr>
						<td><a href="register.jsp">Register?</a></td>
						<td><a href="#" class="right button" onclick="return loginClicked()">Login</a></td>
					</tr>
				</table>
				<input type="submit" class="hidden" />
			</form>
		</div>
		<%
			// Clear all the attributes after they have been read.
			session.setAttribute("login_errors", null);
			session.setAttribute("username", null);
		%>
	</div>
	<hr></hr>
	<%@include file="footer.jsp"%>
</body>
</html>
